package uppgift3;

import java.util.Comparator;


public class KruskalEdge<E extends Edge> implements Comparator<E> {

	/**
	 * Compares two Edges on their weight.
	 * @param compareEdge The Edge to compare to..
	 * @throws NullPointerException If compareEdge is null..
	 * @return 1, -1, and 0 if they are equal.
	 */

	@Override
	public int compare(E firstEdge, E secondEdge) {
		if(firstEdge == null || secondEdge == null) {
			throw new NullPointerException();
		}
		
		if (firstEdge.getWeight() > secondEdge.getWeight()) {
			return 1;
		} else if(firstEdge.getWeight() < secondEdge.getWeight()){
			return -1;
		} else {
			return 0;
		}
	}
}